package com.xinwei.leetcode;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;

public class leetcode4 {

    public static void main(String[] args) {
        int[] nums1 = new int[]{};
        int[] nums2 = new int[]{2};
        int m = nums1.length;
        int n = nums2.length;
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            list.add(nums1[i]);
        }
        for (int i = 0; i < n; i++) {
            list.add(nums2[i]);
        }
        Collections.sort(list);
        double a;
        if ((m + n) % 2 == 0) {
            a = (list.get((m + n) / 2 - 1) + list.get((m + n) / 2)) / 2.0;
        }else {
            a = list.get((m + n + 1) / 2 - 1);
        }
        System.out.println(a);

    }


}
